package com.luojie.service.impl;

import com.luojie.mapper.PositionMapper;
import com.luojie.po.Position;
import com.luojie.service.PositionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

@Service
@Slf4j
public class PositionServiceImpl implements PositionService {
    @Autowired
    private PositionMapper positionMapper;

    @Override
    public List<String> selectPosition() {
        List<Position> positions = positionMapper.selectPosition();
        List<String> name = positions.stream().map(Position::getProvince).collect(Collectors.toList());
        return name.stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
    }
}
